package com.liuzhilong.infrastructure.basic.factory.abstracts;

import com.liuzhilong.infrastructure.basic.factory.abstracts.hp.HpFactory;
import com.liuzhilong.infrastructure.basic.factory.abstracts.mac.MacFactory;

/**
 * 使用方式
 */
public class UseCase {

    public static void main(String[] args) {
        useAbstractFactory();
    }

    public static final void useAbstractFactory() {
        //使用hp的产品簇
        AbstractFactory factory = new HpFactory();
        use(factory);
        //切换到mac的产品簇
        factory=new MacFactory();
        use(factory);







    }
    private static final void use(AbstractFactory abstractFactory){
        Mouse mouse = abstractFactory.getMouse();
        mouse.move();
        Keyboard keyboard = abstractFactory.getKeyboard();
        keyboard.print();
    }
}
